package edu.cmu.cs.webapp.ioms.perspectives;

import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;

import edu.cmu.cs.webapp.ioms.views.CustomersListView;
import edu.cmu.cs.webapp.ioms.views.InventoryView;
import edu.cmu.cs.webapp.ioms.views.LogView;
import edu.cmu.cs.webapp.ioms.views.OrderDetailsView;
import edu.cmu.cs.webapp.ioms.views.OrdersListView;

/**
 * @author Christian
 * 
 */
public class OrderManagementPerspective implements IPerspectiveFactory {

	public static final String PERSPECTIVE_ID = "edu.cmu.cs.webapp.ioms.perspectives.orderManagement";

	public void createInitialLayout(IPageLayout layout) {
		layout.setEditorAreaVisible(false);
		// create left folder
		IFolderLayout leftFolder = layout.createFolder("leftFolder",
				IPageLayout.LEFT, new Float(0.22).floatValue(),
				IPageLayout.ID_EDITOR_AREA);

		// create top folder(placeholder)
		IFolderLayout topFolder = layout.createFolder("topFolder",
				IPageLayout.TOP | IPageLayout.TOP,
				new Float(0.60).floatValue(), IPageLayout.ID_EDITOR_AREA);

		// IFolderLayout bottomFolder = layout.createFolder("bottomFolder",
		// IPageLayout.BOTTOM, new Float(0.40).floatValue(),
		// IPageLayout.ID_EDITOR_AREA);

		// add orders list view to the top folder
		topFolder.addView(OrdersListView.ID_VIEW);
		topFolder.addView(InventoryView.ID_VIEW);
		topFolder.addView(CustomersListView.ID_VIEW);
		// add order details view to the left folder
		leftFolder.addView(OrderDetailsView.ID_VIEW);
		// bottomFolder.addView(MaterialsView.ID_VIEW);

		// create left bottom folder relative to order details view
		// IFolderLayout leftBottomFolder = layout.createFolder("leftBottom",
		// IPageLayout.BOTTOM, new Float(0.70).floatValue(),
		// OrderDetailsView.ID_VIEW);
		// //add log view to order details view
		// leftBottomFolder.addView(LogView.ID_VIEW);

		layout.getViewLayout(OrdersListView.ID_VIEW).setCloseable(false);
		layout.getViewLayout(OrdersListView.ID_VIEW).setMoveable(true);

		// layout.getViewLayout(OrderDetailsView.ID_VIEW).setMoveable(false);
		layout.getViewLayout(InventoryView.ID_VIEW).setCloseable(false);
		layout.getViewLayout(CustomersListView.ID_VIEW).setCloseable(false);

	}
}
